# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.DiscoveryEngine.V1beta.Model.GoogleCloudDiscoveryengineV1Control do
  @moduledoc """
  Defines a conditioned behavior to employ during serving. Must be attached to a ServingConfig to be considered at serving time. Permitted actions dependent on `SolutionType`.

  ## Attributes

  *   `associatedServingConfigIds` (*type:* `list(String.t)`, *default:* `nil`) - Output only. List of all ServingConfig IDs this control is attached to. May take up to 10 minutes to update after changes.
  *   `boostAction` (*type:* `GoogleApi.DiscoveryEngine.V1beta.Model.GoogleCloudDiscoveryengineV1ControlBoostAction.t`, *default:* `nil`) - Defines a boost-type control
  *   `conditions` (*type:* `list(GoogleApi.DiscoveryEngine.V1beta.Model.GoogleCloudDiscoveryengineV1Condition.t)`, *default:* `nil`) - Determines when the associated action will trigger. Omit to always apply the action. Currently only a single condition may be specified. Otherwise an INVALID ARGUMENT error is thrown.
  *   `displayName` (*type:* `String.t`, *default:* `nil`) - Required. Human readable name. The identifier used in UI views. Must be UTF-8 encoded string. Length limit is 128 characters. Otherwise an INVALID ARGUMENT error is thrown.
  *   `filterAction` (*type:* `GoogleApi.DiscoveryEngine.V1beta.Model.GoogleCloudDiscoveryengineV1ControlFilterAction.t`, *default:* `nil`) - Defines a filter-type control Currently not supported by Recommendation
  *   `name` (*type:* `String.t`, *default:* `nil`) - Immutable. Fully qualified name `projects/*/locations/global/dataStore/*/controls/*`
  *   `promoteAction` (*type:* `GoogleApi.DiscoveryEngine.V1beta.Model.GoogleCloudDiscoveryengineV1ControlPromoteAction.t`, *default:* `nil`) - Promote certain links based on predefined trigger queries. This now only supports basic site search.
  *   `redirectAction` (*type:* `GoogleApi.DiscoveryEngine.V1beta.Model.GoogleCloudDiscoveryengineV1ControlRedirectAction.t`, *default:* `nil`) - Defines a redirect-type control.
  *   `solutionType` (*type:* `String.t`, *default:* `nil`) - Required. Immutable. What solution the control belongs to. Must be compatible with vertical of resource. Otherwise an INVALID ARGUMENT error is thrown.
  *   `synonymsAction` (*type:* `GoogleApi.DiscoveryEngine.V1beta.Model.GoogleCloudDiscoveryengineV1ControlSynonymsAction.t`, *default:* `nil`) - Treats a group of terms as synonyms of one another.
  *   `useCases` (*type:* `list(String.t)`, *default:* `nil`) - Specifies the use case for the control. Affects what condition fields can be set. Only applies to SOLUTION_TYPE_SEARCH. Currently only allow one use case per control. Must be set when solution_type is SolutionType.SOLUTION_TYPE_SEARCH.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :associatedServingConfigIds => list(String.t()) | nil,
          :boostAction =>
            GoogleApi.DiscoveryEngine.V1beta.Model.GoogleCloudDiscoveryengineV1ControlBoostAction.t()
            | nil,
          :conditions =>
            list(GoogleApi.DiscoveryEngine.V1beta.Model.GoogleCloudDiscoveryengineV1Condition.t())
            | nil,
          :displayName => String.t() | nil,
          :filterAction =>
            GoogleApi.DiscoveryEngine.V1beta.Model.GoogleCloudDiscoveryengineV1ControlFilterAction.t()
            | nil,
          :name => String.t() | nil,
          :promoteAction =>
            GoogleApi.DiscoveryEngine.V1beta.Model.GoogleCloudDiscoveryengineV1ControlPromoteAction.t()
            | nil,
          :redirectAction =>
            GoogleApi.DiscoveryEngine.V1beta.Model.GoogleCloudDiscoveryengineV1ControlRedirectAction.t()
            | nil,
          :solutionType => String.t() | nil,
          :synonymsAction =>
            GoogleApi.DiscoveryEngine.V1beta.Model.GoogleCloudDiscoveryengineV1ControlSynonymsAction.t()
            | nil,
          :useCases => list(String.t()) | nil
        }

  field(:associatedServingConfigIds, type: :list)

  field(:boostAction,
    as: GoogleApi.DiscoveryEngine.V1beta.Model.GoogleCloudDiscoveryengineV1ControlBoostAction
  )

  field(:conditions,
    as: GoogleApi.DiscoveryEngine.V1beta.Model.GoogleCloudDiscoveryengineV1Condition,
    type: :list
  )

  field(:displayName)

  field(:filterAction,
    as: GoogleApi.DiscoveryEngine.V1beta.Model.GoogleCloudDiscoveryengineV1ControlFilterAction
  )

  field(:name)

  field(:promoteAction,
    as: GoogleApi.DiscoveryEngine.V1beta.Model.GoogleCloudDiscoveryengineV1ControlPromoteAction
  )

  field(:redirectAction,
    as: GoogleApi.DiscoveryEngine.V1beta.Model.GoogleCloudDiscoveryengineV1ControlRedirectAction
  )

  field(:solutionType)

  field(:synonymsAction,
    as: GoogleApi.DiscoveryEngine.V1beta.Model.GoogleCloudDiscoveryengineV1ControlSynonymsAction
  )

  field(:useCases, type: :list)
end

defimpl Poison.Decoder,
  for: GoogleApi.DiscoveryEngine.V1beta.Model.GoogleCloudDiscoveryengineV1Control do
  def decode(value, options) do
    GoogleApi.DiscoveryEngine.V1beta.Model.GoogleCloudDiscoveryengineV1Control.decode(
      value,
      options
    )
  end
end

defimpl Poison.Encoder,
  for: GoogleApi.DiscoveryEngine.V1beta.Model.GoogleCloudDiscoveryengineV1Control do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
